// Learn TypeScript:
//  - https://docs.cocos.com/creator/2.4/manual/en/scripting/typescript.html
// Learn Attribute:
//  - https://docs.cocos.com/creator/2.4/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
//  - https://docs.cocos.com/creator/2.4/manual/en/scripting/life-cycle-callbacks.html

import { Utils } from "../../CCFramework/util/Utils";

const { ccclass, property } = cc._decorator;

@ccclass
export default class NewClass extends cc.Component {
    @property(cc.Node)
    src: cc.Node = null;

    @property(cc.Sprite)
    target: cc.Sprite = null;

    start() {
        let texture = Utils.renderNodeToTexture(this.src, null, 5);
        this.target.spriteFrame = new cc.SpriteFrame();
        this.target.spriteFrame.setTexture(texture);
    }
}
